home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / Issue41 / ComCorn / LVItem.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1998-12-02  |  1.5 KB  |  70 lines

  1. unit LVItem;
  2.  
  3. interface
  4.  
  5. uses
  6.   ComObj, ActiveX, ComCtrls, LVCtrl_TLB, StdVcl, AxCtrls;
  7.  
  8. type
  9.   TListItem = class(TAutoIntfObject, IListItem)
  10.   private
  11.     FListItem: ComCtrls.TListItem;
  12.   protected
  13.     function Get_Caption: WideString; safecall;
  14.     function Get_Index: Integer; safecall;
  15.     function Get_SubItems: IStrings; safecall;
  16.     procedure Set_Caption(const Value: WideString); safecall;
  17.     procedure Set_SubItems(const Value: IStrings); safecall;
  18.     function Get_Checked: WordBool; safecall;
  19.     procedure Set_Checked(Value: WordBool); safecall;
  20.   public
  21.     constructor Create(AOwner: ComCtrls.TListItem);
  22.   end;
  23.  
  24. implementation
  25.  
  26. uses ComServ;
  27.  
  28. constructor TListItem.Create(AOwner: ComCtrls.TListItem);
  29. begin
  30.   inherited Create(ComServer.TypeLib, IListItem);
  31.   FListItem := AOwner;
  32. end;
  33.  
  34. function TListItem.Get_Caption: WideString;
  35. begin
  36.   Result := FListItem.Caption;
  37. end;
  38.  
  39. function TListItem.Get_Index: Integer;
  40. begin
  41.   Result := FListItem.Index;
  42. end;
  43.  
  44. function TListItem.Get_SubItems: IStrings;
  45. begin
  46.   GetOleStrings(FListItem.SubItems, Result);
  47. end;
  48.  
  49. procedure TListItem.Set_Caption(const Value: WideString);
  50. begin
  51.   FListItem.Caption := Value;
  52. end;
  53.  
  54. procedure TListItem.Set_SubItems(const Value: IStrings);
  55. begin
  56.   SetOleStrings(FListItem.SubItems, Value);
  57. end;
  58.  
  59. function TListItem.Get_Checked: WordBool;
  60. begin
  61.   Result := FListItem.Checked;
  62. end;
  63.  
  64. procedure TListItem.Set_Checked(Value: WordBool);
  65. begin
  66.   FListItem.Checked := Value;
  67. end;
  68.  
  69. end.
  70.